package com.zoro.barn.business.service.system.business.rolemenu.dao;

import com.zoro.barn.commons.db.annotations.MybatisMapper;
import com.zoro.barn.business.service.system.business.rolemenu.entity.BarnRoleMenu;

/**
 * @author zhaoxingwu
 */
@MybatisMapper
public interface BarnRoleMenuMapper {

    /**
     * query relationships
     *
     * @param roleId role id
     * @param menuId menu id
     * @return result set
     */
    int hasRoleMenu(String roleId, String menuId);

    /**
     * 添加
     *
     * @param roleMenu r
     */
    void insert(BarnRoleMenu roleMenu);

    /**
     * 删除
     *
     * @param roleMenu r
     */
    void delete(BarnRoleMenu roleMenu);

    /**
     * delete all sub menus
     *
     * @param parentId parent id
     */
    void deleteByParentId(String roleId, String parentId);

    /**
     * 删除所有角色关联菜单
     *
     * @param roleId role id
     */
    void deleteByRole(String roleId);

    /**
     * 删除菜单关联
     *
     * @param menuId menu
     */
    void deleteByMenu(String menuId);

}
